/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 wave_stream.cpp

	$Header: /resource_editor/wave_stream.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )


#include "wave_stream.h"

// ---------------------------------------------------
// sound stream class for an in-memory wave file
// ---------------------------------------------------
t_wave_stream::t_wave_stream( t_shared_array<char> const& data, int size )
                   : m_data( data )
{
	m_position = 0;
	m_size = size;
}

// ---------------------------------------------------
// sound stream class for an in-memory wave file
// ---------------------------------------------------
int t_wave_stream::read( void* data, t_uint32 size )
{
	if (size + m_position > m_size)
		size = m_size - m_position;
	memcpy( data, m_data.get() + m_position, size );
	m_position += size;
	return size;
}
